package com.qqt.csr.file.config;

import com.obs.services.ObsClient;
import com.obs.services.ObsConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({HuaWeiObsProperties.class})
public class HuaWeiObsConfiguration {

    @Bean
    public ObsClient obsClient(HuaWeiObsProperties huaWeiObsProperties) {
        ObsConfiguration config = new ObsConfiguration();
        config.setSocketTimeout(30000);
        config.setConnectionTimeout(10000);
        config.setEndPoint(huaWeiObsProperties.getEndPoint());
        return new ObsClient(huaWeiObsProperties.getAccessKey(), huaWeiObsProperties.getSecretKey(), config);
    }
}
